package com.xuecheng.teaching.agent;


import com.xuecheng.api.comment.model.*;
import com.xuecheng.api.comment.model.dto.CommentDTO;
import com.xuecheng.api.comment.model.dto.ReplyDTO;
import com.xuecheng.common.constant.XcFeignServiceNameList;
import com.xuecheng.common.domain.page.PageRequestParams;
import com.xuecheng.common.domain.page.PageVO;
import com.xuecheng.common.domain.response.RestResponse;
import com.xuecheng.teaching.agent.hystrix.CommentApiAgentFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 *  Feign远程调用 内容管理
 */
@FeignClient(value = XcFeignServiceNameList.XC_COMMENT_SERVICE,fallbackFactory = CommentApiAgentFallbackFactory.class)
public interface CommentApiAgent {

    String SERVICE_CONTEXT_PRE = "comment";

    /**
     * 根据课程发布id 获取课程发布对象信息
     * @param model
     * @return
     */
    @PostMapping(SERVICE_CONTEXT_PRE + "/l/course-comment/creatComment")
    RestResponse<CommentDTO> createComment(@RequestBody CommentModel model);

    @PostMapping(SERVICE_CONTEXT_PRE + "/l/course-comment/querryComment")
    RestResponse<PageVO<CommentDTO>> querryCommentList(@RequestBody QuerryCommentModel querryCommentModel);


//    /**
//     * 根据评论id删除评论信息
//     * @param commentId
//     * @return
//     */
//    @DeleteMapping(SERVICE_CONTEXT_PRE+"l/course-comment/{commentId}")
//    RestResponse deleteCommentById(@PathVariable Long commentId);

    @GetMapping(SERVICE_CONTEXT_PRE + "/l/course-comment/course-statistics/{targetId}")
    RestResponse<CommentStaticsModel> commentStatistics(@PathVariable Long targetId);

    @PostMapping(SERVICE_CONTEXT_PRE + "/l/course-comment/praise/{commentId}")
    RestResponse<Boolean> praiseComment(@PathVariable(value = "commentId") Long commentId, String userName);

    @PostMapping(SERVICE_CONTEXT_PRE + "/l/course-comment/list")
    RestResponse<PageVO> querryOrgCommentList(@RequestBody QuerryCommentModel model);

    @PostMapping(SERVICE_CONTEXT_PRE + "/l/course-comment-reply")
    RestResponse<ReplyDTO> commentReply(@RequestBody ReplyModel model);

    @DeleteMapping(SERVICE_CONTEXT_PRE+"/l/m/course-comment/{commentId}")
    RestResponse<Boolean> deleteCommentById(@PathVariable Long commentId);

    @DeleteMapping(SERVICE_CONTEXT_PRE+"/l/m/course-comment/batch-del/{commentIds}")
    RestResponse<Boolean> deleteComments(@PathVariable String[] commentIds);

    @PostMapping(SERVICE_CONTEXT_PRE + "/l/m/course-comment/list-all")
    RestResponse<PageVO> querryOrgAllCommentList(@RequestBody QuerryCommentModel model);

}
